﻿@{
}
<section class="container-fluid m15_t">
    <div class="data-wrap case">
        <form class="form-inline" id="formSearch">
            <div class="data-tool clearfix">
                <div class="pull-left form-inline ">
                </div>
                <div class="pull-right">
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l gettext">状态：</label>
                        <select class="form-control gettext" name="status">
                            <option value="">请选择</option>
                            <option value="0">未打款</option>
                            <option value="1">处理中</option>
                            <option value="2">已打款</option>
                            <option value="3">驳回</option>
                        </select>
                    </div>

                    <button type="button" class="btn btn-default btn-sm active gettext" id="btnSearch">搜索</button>
                </div>
            </div>
        </form>
        <div class="data-easyui data-scroll">
            <div class="data-view">
                <div class="data-div-view table-responsive">
                    <table class="table" id="pager"></table>
                </div>
            </div>
        </div>
    </div>
</section>
@section footerScript{
    <script type="text/javascript">

        var pageSize = 10;

        $(function () {
            FlashPay.UI.DataAutoHeight();

            doSearch();

            $("#btnSearch").click(function () {
                doSearch();
            });

        });

        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }

        function getParams() {
            var params = $("#formSearch").serializeJSON();
            return params;
        }

        function doSearch() {
            var frozenColumns = [[
                {
                    field: 'bankName', title: "银行名称", width: 75,
                    align: 'left',
                    formatter: function (val, item) {
                        if (!FlashPay.Util.isNullOrEmptySpance(val)) {
                            return '{0}'.format(val);
                        }
                    }
                },
                {
                    field: 'cardName', title: "姓名", width: 75,
                    align: 'left',
                    formatter: function (val, item) {
                        if (!FlashPay.Util.isNullOrEmptySpance(val)) {
                            return '{0}'.format(val);
                        }
                    }
                },
                {
                    field: 'cardNumber', title: "卡号", width: 150,
                    align: 'left',
                    formatter: function (val, item) {
                        if (!FlashPay.Util.isNullOrEmptySpance(val)) {
                            return '{0}'.format(val);
                        }
                    }
                }
            ]];

            var columns = [[
                {
                    field: '_Amount',
                    title: '结算金额',
                    width: 75,
                    align: 'right'
                },
                {
                    field: '_Fee',
                    title: '手续费',
                    width: 75,
                    align: 'right'
                },
                {
                    field: '_HandTime',
                    title: '处理时间',
                    width: 120,
                    align: 'left'
                },
                {
                    field: '_HandBy',
                    title: '处理人',
                    width: 75,
                    align: 'left'
                },
                {
                    field: 'status',
                    title: '状态',
                    width: 75,
                    align: 'left',
                    formatter: function (val, item) {

                        var result = "";

                        if (val == 0) {
                            result = '<span class="bold">等待审核</span>';
                        } else if (val == 1) {
                            result = '<span class="red bold">处理中</span>';
                        } else if (val == 2) {
                            result = '<span class="green bold">已打款</span>';
                        } else if (val == 3) {
                            result = '<span class="red bold">驳回</span>';
                        }

                        return result;

                    }
                },
                {
                    field: 'remark',
                    title: '备注',
                    width: 200,
                    align: 'left'
                },
                {
                    field: '_CreatedBy',
                    title: '创建人',
                    width: 100,
                    align: 'left'
                },
                {
                    field: '_CreatedDate',
                    title: '创建时间',
                    width: 120,
                    align: 'left'
                },
                {
                    field: 'id',
                    title: '操作',
                    width: 180,
                    align: 'left',
                    formatter: function (val, item) {

                        var result = "";

                        if (item.status == 0) {
                            result += '<a class="btn btn-success btn-xs" data-confirm="确定要<span class=orange>审核</span>该订单？" data-succesFun="doSearch()" data-href="/Settle/Audit/{0}">审核</a>'.format(val);
                        } else if (item.status == 1) {
                            result += '<a class="btn btn-success btn-xs" data-confirm="确定要<span class=orange>确认打款</span>该订单？" data-succesFun="doSearch()" data-href="/Settle/Confirm/{0}">确认打款</a>'.format(val);
                            result += ' <a class="btn btn-success btn-xs" data-confirm="确定要<span class=orange>驳回</span>该订单？" data-succesFun="doSearch()" data-href="/Settle/Reject/{0}">驳回</a>'.format(val);
                            result += ' <a class="btn btn-default btn-xs" data-modal="/Settle/Remark/{0}" data-title="备注" data-width="420" data-height="230"> 备注</a>'.format(val);
                        }
                        return result;

                    }
                }

            ]];

            $("#pager").datagrid({
                fit: false,
                loadMsg: '数据加载中，请稍后……',
                method: "get",
                border: true,
                url: '/Settle/SettleQuery',
                queryParams: getParams(),
                pagination: true,
                pageSize: pageSize,
                pageList: [10, 15, 30, 50, 100, 1000],
                height: $(window).height() - 70,
                singleSelect: true,
                rownumbers: true,
                showFooter: true,
                idField: 'id',
                onLoadSuccess: function () {
                    pageSize = $('#pager').datagrid('options').pageSize;
                },
                frozenColumns: frozenColumns,
                columns: columns
            });
        }
    </script>
}